Comme vu dans l'introduction JULIA possède une bibliothèque de package assez grande dont il n'est pas forcément aisé d'en faire le tri...
Je vous propose ici la description et utilisation de quelques classiques
En premier lieu un packages graphiques :
et deux packages plus "statistiques" :
La gestion graphique ne fait pas partie intégrante de JULIA il faut faire appel à des packages extérieurs et plusieurs choix sont possibles. En voici quelques uns
Plots est basé sur une bibliothèque éprouvée MatPlotLib (en Python). Sa syntaxe est identique à celle de MATLAB
In [ ]:
(v1.1) pkg> add Plots
(v1.1) pkg> add PlotlyJS
(v1.1) pkg> add PyPlot
In [43]:
using Plots
In [44]:
x=range(0,stop=1,length=3000);
plot(x,sin.(10*x))
Out[44]:
In [49]:
x=range(0,stop=1,length=3000);
plot(x,sin.(10*x))
plot!(x,cos.(10*x))
Out[49]:
In [52]:
subplot(2,1,1)
plot(x,sin.(x),"g",linewidth=2.0)
subplot(2,1,2)
plot(x,x,"r")
grid(true)
title("tracé 2")
In [51]:
n=1024
X=randn(n)
Y=randn(n)
scatter(X,Y)
Out[51]:
In [5]:
X=rand(5)
Y=-rand(5)
bar(1:5,X,facecolor="#9999ff", edgecolor="white")
bar(1:5,Y,facecolor="#ff9999", edgecolor="white")
for i=1:5
txt=string(X[i])
text(i+0.1,X[i]+0.01,txt[1:7])
txt=string(Y[i])
text(i+0.1,Y[i]-0.08,txt[1:7])
end
ylim(-1.2,1.2)
In [6]:
z=rand(20)
pie(z);
In [7]:
contour(rand(50,50))
colorbar()
In [8]:
surf(rand(50,50))
In [9]:
X=[x for x=-1:0.2:1, y=-1:0.2:1]
Y=[y for x=-1:0.2:1, y=-1:0.2:1]
quiver(-1:0.2:1,-1:0.2:1,X,Y)
D'autres packages sont disponible Gadfly, Winston, AsciiPlot, GLVisualize...
In [28]:
using DataFrames
In [29]:
df = DataFrame(A = 1:4, B = ["M", "F", "F", "M"])
Out[29]:
In [30]:
df = DataFrame()
df[:A] = 1:8;
df[:B] = ["M", "F", "F", "M", "F", "M", "M", "F"];
df
Out[30]:
In [31]:
nrows = size(df, 1) # nombre de ligne
ncols = size(df, 2) # nombre de colonne
Out[31]:
In [33]:
first(df)#Voir le début du tableau
Out[33]:
In [34]:
last(df) #Voir la fin du tableau
Out[34]:
In [35]:
df[1:3, :] #Voir les lignes 1,2,3 du tableau
Out[35]:
Nous avons l'analogie avec summarize du logiciel R :
In [36]:
describe(df)
Out[36]:
In [38]:
using RDatasets